<%#
 Copyright 2020 Jo-Philipp Wich <jo@mein.io>
 Licensed to the public under the Apache License 2.0.
-%>

<%
	local sys  = require "luci.sys"
	local util = require "luci.util"
	local http = require "luci.http"
	local disp = require "luci.dispatcher"
	local ver  = require "luci.version"

	local boardinfo = util.ubus("system", "board") or { }

	local node = disp.context.dispatched
	local path = table.concat(disp.context.path, "-")

	http.prepare_content("text/html; charset=UTF-8")
-%>

<html lang="<%=luci.i18n.context.lang%>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/cascade.css" />
<link rel="icon" href="<%=media%>/favicon.png" type="image/svg+xml" />
<script type="text/javascript" src="<%=url('admin/translations', luci.i18n.context.lang)%><%# ?v=PKG_VERSION %>"></script>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<title><%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI</title>
</head>
<body class="lang_<%=luci.i18n.context.lang%>" data-page="<%= pcdata(path) %>">

<p class="skiplink">
<span id="skiplink1"><a href="#navigation"><%:Skip to navigation%></a></span>
<span id="skiplink2"><a href="#content"><%:Skip to content%></a></span>
</p>

<div id="menubar">
	<h2 class="navigation"><a id="navigation" name="navigation"><%:Navigation%></a></h2>

	<span class="hostname"><a class="brand" href="/">
	<svg width="103.868" height="29.117" viewBox="0 0 103.868 29.117" xmlns="http://www.w3.org/2000/svg"><g id="svgGroup" stroke-linecap="round" fill-rule="evenodd" font-size="9pt" stroke="#000" stroke-width="0.00mm" fill="none">
	<path d="m103,0l-63,0c-2.244,0.252 -3.478,1.624 -3.696,4.128l0,20.847c0.215,2.501 1.447,3.868 3.676,4.129l60,0c2.23,-0.261 3.461,-1.629 3.677,-4.129l0,-20.847c-0.217,-2.504 -1.452,-3.876 -3.694,-4.128" fill="#f7971d"/>
	<path d="m70.945,3.604l0,-3.604l20.162,0l0,3.604l-8.279,0l0,21.603l-3.603,0l0,-21.603l-8.28,0zm-3.955,6.345l0,11.795q0,0.721 -0.272,1.354a3.485,3.485 0 0 1 -0.739,1.098a3.513,3.513 0 0 1 -1.089,0.739a3.313,3.313 0 0 1 -1.3,0.272a3.79,3.79 0 0 1 -0.045,0l-9.299,0a3.343,3.343 0 0 1 -1.336,-0.272a3.485,3.485 0 0 1 -1.098,-0.739q-0.466,-0.466 -0.739,-1.098q-0.272,-0.633 -0.272,-1.354l0,-11.795q0,-0.72 0.272,-1.353a3.485,3.485 0 0 1 0.739,-1.099q0.465,-0.466 1.098,-0.738a3.343,3.343 0 0 1 1.336,-0.273l9.299,0a3.355,3.355 0 0 1 1.187,0.209a3.201,3.201 0 0 1 0.158,0.064q0.624,0.272 1.089,0.738q0.466,0.466 0.739,1.099q0.272,0.633 0.272,1.353zm-25.91,-9.949l3.604,0l0,25.207l-3.604,0l0,-25.207zm22.465,9.949l-9.299,0l0,11.795l9.299,0l0,-11.795z" fill="#fe9e24"/>
	<path d="m0.193,2.05l4.342,0l6.733,9.439l6.767,-9.439l4.36,0l-8.93,12.498l9.123,12.709l-4.359,0l-6.961,-9.686l-6.909,9.686l-4.359,0l9.123,-12.709l-8.93,-12.498zm26.35,16.787l0,-3.463l8.42,0l0,3.463l-8.42,0z" fill="white" stroke-width="0.00mm" stroke="#000"/>
	<path d="m48.217,27.257l-3.604,0l-6.047,-18.721l3.498,0l4.43,14.116l4.131,-14.116l3.533,0l4.131,14.116l4.43,-14.116l3.498,0l-6.047,18.721l-3.604,0l-4.183,-13.746l-4.166,13.746zm38.865,-15.258l0,-3.463l4.57,0l0,-5.765l3.463,0l0,5.765l6.153,0l0,3.463l-6.153,0l0,11.795l6.153,0l0,3.463l-6.153,0a3.343,3.343 0 0 1 -1.336,-0.272a3.593,3.593 0 0 1 -1.107,-0.739a3.413,3.413 0 0 1 -0.747,-1.098q-0.273,-0.633 -0.273,-1.354l0,-11.795l-4.57,0zm-6.68,0l-7.136,0l0,15.258l-3.446,0l0,-18.721l3.446,0l0,3.305q0.035,-0.686 0.316,-1.292q0.281,-0.606 0.747,-1.055a3.444,3.444 0 0 1 1.081,-0.703q0.615,-0.255 1.319,-0.255l3.673,0a3.355,3.355 0 0 1 1.188,0.209a3.201,3.201 0 0 1 0.157,0.064q0.624,0.272 1.099,0.738a3.413,3.413 0 0 1 0.747,1.099q0.272,0.633 0.272,1.353l0,3.164l-3.463,0l0,-3.164z" fill="black" stroke-width="0.05mm" stroke="#000"/>
	</g></svg>
	</a></span>
	<span class="distversion"><%=ver.distversion%></span>
	<span id="indicators"></span>
</div>

<div id="modemenu" style="display:none"></div>

<div id="maincontainer">
	<div id="mainmenu"></div>

	<div id="maincontent">
		<%- if luci.sys.process.info("uid") == 0 and luci.sys.user.getuser("root") and not luci.sys.user.getpasswd("root") and category ~= "failsafe" and path ~= "admin-system-admin-password" then -%>
		<div class="alert-message warning">
			<h4><%:No password set!%></h4>
			<p><%:There is no password set on this router. Please configure a root password to protect the web interface and enable SSH.%></p>
			<% if disp.lookup("admin/system/admin") then %>
				<div class="right"><a class="btn" href="<%=url("admin/system/admin")%>"><%:Go to password configuration...%></a></div>
			<% end %>
		</div>
		<%- end -%>

		<div id="tabmenu" style="display:none"></div>
